package com.lanyou.esb.cook.proxy.meta;

import java.rmi.NoSuchObjectException;

import org.apache.commons.lang3.StringUtils;

/**
 * 系统类型 <br>
 * 描述：<br>
 * 1：服务发布方系统；2：服务调用方系统；
 * 
 * @author Davey.wu
 */
public enum SystemType {
	//
	PROVIDER("1"), CONSUMER("2");

	public static final String TypeCode = "20035";

	public final String ValueCode;

	private SystemType(String code) {
		this.ValueCode = code;
	}

	public static SystemType get(String valueCode) throws NoSuchObjectException {
		if (StringUtils.isEmpty(valueCode)) {
			throw new NullPointerException();
		}
		for (SystemType type : SystemType.values()) {
			if (type.ValueCode.equals(valueCode)) {
				return type;
			}
		}
		throw new NoSuchObjectException(valueCode);
	}
}
